<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<ui:composition template="/templatePrincipal.xhtml" xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:a4j="http://richfaces.org/a4j"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:rich="http://richfaces.org/rich">
    <ui:define name="conteudo" >
        <rich:spacer height="20"/>
        <center>
            <rich:messages layout="table"
                           errorClass="errorClass"
                           infoClass="infoClass"
                           warnClass="warnClass"
                           styleClass="painelMensagem"
                           ajaxRendered="true"/>
        </center>
        <rich:spacer height="10"/>
        <a4j:form ajaxSubmit="true">
            <center>
                <h:outputLabel for="somCampeao" value="Time campeao: "/>
                <h:selectOneMenu id="somCampeao" value="#{jogoCadastroAction.equipeSelecionada}">
                    <s:selectItems value="#{jogoCadastroAction.listaEquipes}" var="e" label="#{e.nome}" itemValue="#{e.idEquipe}" noSelectionLabel="..." />
                </h:selectOneMenu>
                <rich:spacer width="10"/>
                <h:outputLabel for="somVice" value="Time vice-campeao: "/>
                <h:selectOneMenu id="somVice" value="#{jogoCadastroAction.equipeSelecionada}">
                    <s:selectItems value="#{jogoCadastroAction.listaEquipes}" var="e" label="#{e.nome}" itemValue="#{e.idEquipe}" noSelectionLabel="..." />
                </h:selectOneMenu>
                <br></br>
                <br></br>
                <rich:dataTable id="dtJogos"
                                value="#{jogosAction.listaJogos}" var="_jogos"
                                width="80%" rows="25"
                                cellpadding="0" cellspacing="0"
                                captionClass="bold"
                                columnClasses="colunaCentralizada,colunaCentralizada, colunaCentralizada"
                                columnsWidth="80,150, 150,280"
                                onRowMouseOver="this.style.backgroundColor='#eff7ff'"
                                onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'">
                    <f:facet name="header">
                        Cadastro dos Resultados dos Jogos
                    </f:facet>
                    <rich:column>
                        <f:facet name="header">
                            Data do jogo
                        </f:facet>
                        <h:outputText value="#{_jogos.dataJogo}">
                            <f:convertDateTime pattern="dd/MM/yyyy" />
                        </h:outputText>
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">
                            Time 1
                        </f:facet>
                        #{_jogos.time1}
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">
                            Time 2
                        </f:facet>
                        #{_jogos.time2}
                    </rich:column>
                    <rich:column>
                        <f:facet name="header">
                            Resultado
                        </f:facet>
                        <center>
                            <h:panelGrid cellspacing="1" cellpadding="1" columns="7" columnClasses="field-names, fields">
                                <h:outputLabel for="itGolsTime1" value="#{_jogos.time1}">
                                </h:outputLabel>
                                <h:inputText id="itGolsTime1" value="#{_jogos.golsTime1}" style="width:20px;"/>
                                <h:outputLabel value="x">
                                </h:outputLabel>
                                <h:inputText id="itGolsTime2" value="#{_jogos.golsTime2}" style="width:20px;"/>
                                <h:outputLabel for="itGolsTime2" value="#{_jogos.time2}">
                                </h:outputLabel>
                                <a4j:commandLink id="clSalvar"
                                                 action="#{jogosAction.cadastroResultado(_jogos)}"
                                                 styleClass="link dr-toolbar-ext rich-toolbar">
                                    <h:graphicImage value="/resources/images/dialog-ok-old.png"/>
                                    <h:outputText value="OK"/>
                                </a4j:commandLink>
                            </h:panelGrid>
                        </center>
                    </rich:column>
                </rich:dataTable>
            </center>
            <br></br>
        </a4j:form>
    </ui:define>
</ui:composition>
